<template>
  <div class="examMade">
    <Card style="margin-bottom:20px">
      <Form ref="queryForm" :model="queryForm" :rules="roleValidate" style="display: block;">
        <Row gutter="50">
          <!-- <i-col span="3"
            style="height:30px; line-height:30px; color:rgba(80, 80, 80, 1); margin-right:-50px;">条件筛选：</i-col> -->
          <i-col span="6">
            <FormItem prop="workType">
              <Select v-model="queryForm.workType" clearable placeholder="工作类型">
                <Option v-for="item in newsList" :key="item.key" :value="item.key">{{ item.value }}</Option>
              </Select>
            </FormItem>
          </i-col>
          <i-col span="6">
            <FormItem prop="workDate">
              <DatePicker type="daterange" placement="bottom-end" placeholder="工作日志日期起止期" v-model="queryForm.workDate"
                @on-change="workDateChange" style="width: 100%"></DatePicker>
            </FormItem>
          </i-col>
        </Row>
        <Row>
          <i-col span="12">
            <FormItem>
              <Button type="primary" @click="submitForm(0)" :loading="queryLoading">查询</Button>
              <Button class="resetForm" @click="resetForm" style="margin: 0 20px;">重置</Button>
              <Button type="primary" @click="modal1 = true">工作日志制定</Button>
            </FormItem>
          </i-col>
        </Row>
      </Form>
      <Row>
        <i-col span="20">
          <span>工作类型：</span>
          <Button :type="btn[0]" @click="buttonClick(0)" class="statusButton">全部</Button>
          <Button :type="btn[1]" @click="buttonClick(1)" class="statusButton statusButton2">未回销</Button>
          <Button :type="btn[2]" @click="buttonClick(2)" class="statusButton" style="width:96px;">已回销</Button>
        </i-col>
      </Row>
    </Card>

    <!-- 工作日志列表 -->
    <Row class="listgroup">
      <div v-for="(item, index) in workLogList" :key="index">
        <i-col span="6" class="examCard">
          <Card style="width:85%; position: relative;" shadow>
            <div slot="extra">
              <div v-if="item.status == '未回销' || item.status == '重新回销'" class="cardExtra cardExtra1">未回销</div>
              <div v-if="item.status == '未回销' || item.status == '重新回销'" class="dropright dropright1">
                <Icon type="md-arrow-dropright" />
              </div>
              <div v-if="item.status == '已回销'" class="cardExtra cardExtra2">已回销</div>
              <div v-if="item.status == '已回销'" class="dropright dropright2">
                <Icon type="md-arrow-dropright" />
              </div>
            </div>

            <div class="cardStyle" @click="logDetail(item, index)">
              <Row>
                <i-col span="22">
                  <div class="cardTitle">工作类型：{{ item.workType }}</div>
                </i-col>
                <!-- ''：未评价，0：未读，1：已读 -->
                <i-col span="2" style="font-size:22px; margin-top: -6px;" :class="item.isRead == '2' ? 'tRed' : ''"
                  v-if="item.isRead == '2' || item.isRead == '3'">
                  <img src="static/image/message-failed-outlined-disable.png" alt="">
                </i-col>
                <!-- 评价回复 -->
                <i-col span="2" style="font-size:22px; margin-top: -6px;" :class="item.isRead == '0' ? 'tRed' : ''"
                  v-if="item.isRead == '0' || item.isRead == '1'">
                  <span class="ivu-icon ivu-icon-md-alert"></span>
                </i-col>
              </Row>

              <div class="cardContent">
                <div>
                  <Icon type="ios-time" class="cardIcon" />
                  工作时间：{{ item.makeDay }} {{ item.makeTime }}
                </div>
                <!-- <div class="cardFile">
                  <Icon type="ios-pin" class="cardIcon" />
                  工作地点：{{item.workSite}}
                </div>
                <div class="cardFile">
                  <Icon type="ios-checkbox" class="cardIcon" />
                  工作内容：{{item.expectEffect}}
                </div>
                <div class="cardFile">
                  <Icon type="ios-document" class="cardIcon" />
                  <span>{{item.smallFile}}</span>
                </div> -->
                <div>
                  计划面访保单{{ item.detailNum ? item.detailNum.plantalkcount : 0 }}张，已面访{{
                    item.detailNum ?
                      item.detailNum.donetalkcount : 0
                  }}张
                </div>
                <div>
                  计划电访保单{{ item.detailNum ? item.detailNum.planphonecount : 0 }}张，已电访{{
                    item.detailNum ?
                      item.detailNum.donephonecount : 0
                  }}张
                </div>
                <div>
                  计划短信保单{{ item.detailNum ? item.detailNum.planmessagecount : 0 }}张，已短信{{
                    item.detailNum ?
                      item.detailNum.donemessagecount : 0
                  }}张
                </div>
                <div>
                  计划网络联系保单{{ item.detailNum ? item.detailNum.plannetcount : 0 }}张，已网络联系{{
                    item.detailNum ?
                      item.detailNum.donenetcount : 0
                  }}张
                </div>
              </div>
            </div>
          </Card>
          <div class="cardFoot">
            <Row v-if="item.status == '未回销'">
              <i-col span="12"><Button type="primary" @click="revokeBtn(item)">回销</Button></i-col>
              <i-col span="12"><Button type="error" @click="retractBtn(item)">撤销</Button></i-col>
            </Row>
            <Button type="warning" v-if="item.status == '重新回销'" @click="reRevokeBtn(item, index)">重新回销</Button>
            <Button type="default" disabled v-if="item.status == '已回销'">回销</Button>
          </div>
        </i-col>
      </div>
    </Row>

    <!-- 翻页 -->
    <div style="margin-right:50px;">
      <Page :total="total" show-total style="text-align:right;margin-top:20px;margin-bottom:30px;" :current="pageIndex"
        :page-size="pageSize" @on-change="pageChange" transfor />
    </div>

    <!-- 工作日志制定 -->
    <Modal v-model="modal1" footer-hide="true" @on-visible-change="modalChange1" width="800px" class="draftModal"
      :mask-closable="false">
      <div slot="header" class="draftTitle">工作日志制定</div>
      <div style="width:100%; margin:0 0 20px 60px;">
        <Form ref="draftForm" :model="draftForm" :rules="draftRoleValidate1" style="display: block;">
          <Row>
            <i-col span="3" style="height:32px; line-height:32px; font-size:14px;">工作类型：</i-col>
            <i-col span="12">
              <FormItem prop="draftNews">
                <Select v-model="draftForm.draftNews" clearable style="width: 168px;">
                  <Option v-for="item in newsList" :key="item.key" :value="item.key">{{ item.value }}</Option>
                </Select>
              </FormItem>
            </i-col>
          </Row>
          <Row>
            <i-col span="3" style="height:32px; line-height:32px; font-size:14px;">工作时间：</i-col>
            <i-col span="7">
              <FormItem prop="draftDate">
                <DatePicker type="date" v-model="draftForm.draftDate" placeholder="请输入工作日期" @on-change="dateChange"
                  style="width:168px;"></DatePicker>
              </FormItem>
            </i-col>
            <i-col span="6">
              <FormItem prop="draftTime">
                <TimePicker type="time" format="HH:mm" v-model="draftForm.draftTime" placeholder="请输入工作时间"
                  style="width: 168px"></TimePicker>
              </FormItem>
            </i-col>
          </Row>
          <Row>
            <i-col span="3" style="height:32px; line-height:32px; font-size:14px;">工作地点：</i-col>
            <i-col span="16">
              <FormItem prop="draftSite">
                <Input type="text" v-model="draftForm.draftSite" placeholder="请输入工作地点" style="width: 392px" />
              </FormItem>
            </i-col>
          </Row>
          <Row>
            <i-col span="3" style="height:32px; line-height:32px; font-size:14px;">工作内容：</i-col>
            <i-col span="16">
              <FormItem v-for="(item, index) in draftForm.expectEffect" :key="index" :prop="item.expectEffect"
                style="margin-bottom:10px">
                <span style="display:inline-block;width:20px">{{ index + 1 + '、' }}</span>
                <Input type="text" v-model="item.expectEffect" style="width: 369px" />
                <Icon v-if="index > 0" type="ios-remove-circle-outline" size="24" @click="deleteExpectEffect(index)" />
              </FormItem>
              <div style="width: 392px;text-align:center;margin-bottom:20px">
                <Icon type="md-add-circle" size="24" @click="addExpectEffect" />
              </div>
            </i-col>
          </Row>
          <Row>
            <i-col span="3" style="height:32px; line-height:32px; font-size:14px;">说明附件：</i-col>
            <i-col span="18">
              <FormItem prop="leaveFile">
                <Uploadv multiple ref="upload1" type="drag" :format="['pdf', 'mp4', 'xls', 'xlsx', 'png', 'jpg']"
                  :on-format-error="handleFormatError1" :before-upload="handleUpload1" :show-upload-list="false"
                  :on-success="uploadSuccess1" :on-error="uploadFail1" :headers="{
                    Authorization: tocken,
                  }" name="multipartFile" :data="{
  applyNo: this.newApplyNo
}" :action="action" style="width:392px;">
                  <Icon type="ios-cloud-upload" size="52" style="color: #3399ff"></Icon>
                  <p>点击或将文件拖拽到这里上传</p>
                  <p style="color:rgba(0,0,0,0.43)">支持扩展名：.pdf .mp4.xls.xlsx.jpg...</p>
                </Uploadv>
                <div>
                  <div v-for="(item, index) in file1" :key="index">
                    <Icon type="md-attach" style="transform:rotate(90deg);" />
                    &nbsp;{{ item.name }}
                    <span @click="delectFile1(item.keyID)" class="deleteFile">X</span>
                  </div>
                </div>
              </FormItem>
            </i-col>
          </Row>
          <Row style="margin-bottom:-40px;">
            <i-col>
              <FormItem style="text-align:center">
                <Button type="primary" style="width:74px;" @click="handleSubmit1()" :loading="draftLoading1">确定</Button>
                <Button type="default" @click="handleReset1" style="width:74px;margin-left:25px">取消</Button>
              </FormItem>
            </i-col>
          </Row>
        </Form>
      </div>
    </Modal>

    <!-- 工作日志回销框 -->
    <Modal v-model="modal2" footer-hide="true" @on-visible-change="modalChange2" width="800px" class="draftModal"
      :mask-closable="false">
      <div slot="header" class="draftTitle">工作日志回销</div>
      <div style="width:100%; margin:0 0 20px 60px;">
        <Form ref="revokeForm" :model="revokeForm" :rules="draftRoleValidate2" style="display: block;">
          <Row>
            <i-col span="3" style="height:32px; line-height:32px; font-size:14px;">工作类型：</i-col>
            <i-col span="12">
              <FormItem prop="revokeNews">
                <Select v-model="revokeForm.revokeNews" clearable style="width: 168px;">
                  <Option v-for="item in newsList" :key="item.key" :value="item.key">{{ item.value }}</Option>
                </Select>
              </FormItem>
            </i-col>
          </Row>
          <Row>
            <i-col span="3" style="height:32px; line-height:32px; font-size:14px;">回销时间：</i-col>
            <i-col span="7">
              <FormItem prop="revokeDate">
                <DatePicker type="date" v-model="revokeForm.revokeDate" placeholder="请输入完成日期" @on-change="dateChange2"
                  :readonly="true" style="width:168px;" format="yyyy-MM-dd"></DatePicker>
              </FormItem>
            </i-col>
            <i-col span="6">
              <FormItem prop="revokeTime">
                <TimePicker type="time" format="HH:mm" v-model="revokeForm.revokeTime" placeholder="请输入完成时间"
                  style="width: 168px" :readonly="true"></TimePicker>
              </FormItem>
            </i-col>
          </Row>
          <Row>
            <i-col span="3" style="height:32px; line-height:32px; font-size:14px;">工作地点：</i-col>
            <i-col span="16">
              <FormItem prop="revokeSite">
                <Input type="text" v-model="revokeForm.revokeSite" placeholder="请输入工作地点" style="width: 392px" />
              </FormItem>
            </i-col>
          </Row>
          <Row>
            <i-col span="3" style="height:32px; line-height:32px; font-size:14px;">完成情况：</i-col>
            <i-col span="18">
              <FormItem v-for="(item, index) in revokeForm.expectEffect2" :key="index" prop="expectEffect2"
                style="margin-bottom:10px">
                <span style="display:inline-block;width:20px">{{ index + 1 + '、' }}</span>
                <Input type="text" v-model="item.expectEffect" style="width: 369px" />
                <Icon v-if="index > 0" type="ios-remove-circle-outline" size="24" @click="deleteExpectEffect2(index)" />
              </FormItem>
              <div style="width: 392px;text-align:center;margin-bottom:20px">
                <Icon type="md-add-circle" size="24" @click="addExpectEffect2" />
              </div>
            </i-col>
          </Row>
          <Row>
            <i-col span="3" style="height:32px; line-height:32px; font-size:14px;">说明附件：</i-col>
            <i-col span="18">
              <FormItem prop="leaveFile">
                <Uploadv multiple ref="upload2" type="drag" :format="['pdf', 'mp4', 'xls', 'xlsx', 'png', 'jpg']"
                  :on-format-error="handleFormatError2" :before-upload="handleUpload2" :show-upload-list="false"
                  :on-success="uploadSuccess2" :on-error="uploadFail2" :headers="{
                    Authorization: tocken,
                  }" name="multipartFile" :data="{
  applyNo: '1'
}" :action="action" style="width:392px">
                  <Icon type="ios-cloud-upload" size="52" style="color: #3399ff"></Icon>
                  <p>点击或将文件拖拽到这里上传</p>
                  <p style="color:rgba(0,0,0,0.43)">支持扩展名：.pdf .mp4.xls.xlsx.jpg...</p>
                </Uploadv>
                <div v-for="(item, index) in file2" :key="index">
                  <div>
                    <Icon type="md-attach" style="transform:rotate(90deg);" />
                    &nbsp;{{ item.name }}
                    <span @click="delectFile2(item.keyID)" class="deleteFile">X</span>
                  </div>
                </div>
              </FormItem>
            </i-col>
          </Row>
          <Row style="margin: 0 0 -40px 90px;">
            <i-col>
              <FormItem style="text-align:center">
                <Button type="primary" style="width:74px;margin-left: -90px;" @click="handleSubmit2()"
                  :loading="draftLoading2">确定</Button>
                <Button type="default" @click="handleReset2" style="width:74px;margin-left:25px">取消</Button>
              </FormItem>
            </i-col>
          </Row>
        </Form>
      </div>
    </Modal>

    <!-- 工作日志详情——未h销 -->
    <Modal v-model="modal3" :transfer="false"  footer-hide="true" @on-ok="uncancelledOK" @on-cancel="uncancelledCancel" width="680px"
      class="revokeModal" :mask-closable="false">
      <div slot="header" class="draftTitle">工作日志详情</div>
      <div style="width:100%; margin:0 0 20px 60px;">
        <Row style="margin-bottom:20px; margin-top:20px;">
          <i-col span="3">工作类型：</i-col>
          <i-col span="12">
            <div>{{ revokeList1.workType }}</div>
          </i-col>
        </Row>
        <Row style="margin-bottom:20px;">
          <i-col span="3">工作时间：</i-col>
          <i-col span="12">
            <div>{{ revokeList1.makeDay }} {{ revokeList1.makeTime }}</div>
          </i-col>
        </Row>
        <Row style="margin-bottom:20px;">
          <i-col span="3">电访情况：</i-col>
          <i-col span="12">
            <div>
              <span>计划{{ revokeList1.detailNum ? revokeList1.detailNum.planphonecount : 0 }}单-完成{{
                revokeList1.detailNum
                  ?
                  revokeList1.detailNum.donephonecount : 0
              }}单-超期{{
  revokeList1.detailNum ?
    revokeList1.detailNum.delayphonecount : 0
}}单</span>
              <Button type="primary" size="small" style="margin-left:5px;"
                @click="linkToWorkRecord(revokeList1, '0')">工作记录</Button>
            </div>
          </i-col>
        </Row>
        <Row style="margin-bottom:20px;">
          <i-col span="3">面访情况：</i-col>
          <i-col span="12">
            <div>
              <span>计划{{ revokeList1.detailNum ? revokeList1.detailNum.plantalkcount : 0 }}单-完成{{
                revokeList1.detailNum
                  ?
                  revokeList1.detailNum.donetalkcount : 0
              }}单-超期{{
  revokeList1.detailNum ?
    revokeList1.detailNum.delaytalkcount : 0
}}单</span>
              <Button type="primary" size="small" style="margin-left:5px;"
                @click="linkToWorkRecord(revokeList1, '1')">工作记录</Button>
            </div>
          </i-col>
        </Row>
        <Row style="margin-bottom:20px;">
          <i-col span="3">短信情况：</i-col>
          <i-col span="12">
            <div>
              <span>计划{{ revokeList1.detailNum ? revokeList1.detailNum.planmessagecount : 0 }}单-完成{{
                revokeList1.detailNum
                  ? revokeList1.detailNum.donemessagecount : 0
              }}单-超期{{
  revokeList1.detailNum ?
    revokeList1.detailNum.delaymessagecount : 0
}}单</span>
              <Button type="primary" size="small" style="margin-left:5px;"
                @click="linkToWorkRecord(revokeList1, '2')">工作记录</Button>
            </div>
          </i-col>
        </Row>
        <Row style="margin-bottom:20px;">
          <i-col span="3">网络情况：</i-col>
          <i-col span="12">
            <div>
              <span>计划{{ revokeList1.detailNum ? revokeList1.detailNum.plannetcount : 0 }}单-完成{{
                revokeList1.detailNum ?
                  revokeList1.detailNum.donenetcount : 0
              }}单-超期{{
  revokeList1.detailNum ?
    revokeList1.detailNum.delaynetcount : 0
}}单</span>
              <Button type="primary" size="small" style="margin-left:5px;"
                @click="linkToWorkRecord(revokeList1, '3')">工作记录</Button>
            </div>
          </i-col>
        </Row>
        <Row style="margin-bottom:20px;">
          <i-col span="3">续期情况：</i-col>
          <i-col span="12">
            <div>
              <span>收费成功{{ revokeList1.detailNum ? revokeList1.detailNum.donefeecount : 0 }}单</span>
              <Button type="primary" size="small" style="margin-left:86px;"
                @click="linkToWorkRecord(revokeList1, '4')">回访登记</Button>
            </div>
          </i-col>
        </Row>
        <Row style="margin-bottom:20px;">
          <i-col span="3">工作地点：</i-col>
          <i-col span="12">
            <div>{{ revokeList1.workSite }}</div>
          </i-col>
        </Row>
        <Row style="margin-bottom:20px;">
          <i-col span="3">工作内容：</i-col>
          <i-col span="18">
            <!-- <div style="max-height:84px; overflow-x:hidden;"> -->
            <!-- <div class="omit">{{revokeList1.expectEffect}}</div> -->
            <div class="omit" v-for="(item, index) in revokeList1.expectEffect || []" :key="index">{{ index + 1 }}
              、{{ item.expectEffect }}</div>
          </i-col>
        </Row>
        <Row style="margin-bottom:20px;">
          <i-col span="3">说明附件：</i-col>
          <i-col span="18">
            <!-- <div style="max-height:84px; overflow-x:hidden;"> -->
            <div>
              <div v-if="revokeList1.smallFile != '暂无附件'">
                <p v-for="(item, index) in revokeList1.files" :key="index" class="see-btn omit"
                  @click="checkFile(item)">
                  {{ item[1] }}</p>
              </div>
              <p v-if="revokeList1.smallFile == '暂无附件'">暂无附件</p>
            </div>
          </i-col>
        </Row>
      </div>
      <div class="start">
        <Row>
          <i-col span="4">
            <div class="start-title">领导评价:</div>
          </i-col>
          <i-col span="18" v-if="assessList.length > 0">
            <!-- <Row class="assess-t" v-for="(item,index) in assessList" :key="index">
                <i-col span="6">
                  <p class="start-body-title">{{item.name}}评价:</p>
                </i-col>
                <i-col span="8">
                  <Rate v-model="item.stars" disabled />
                </i-col>
                <i-col span="8" style="margin-top:5px;">{{item.detail}}</i-col>
              </Row> -->
            <Row class="assess-t" v-for="(item, index) in assessList" :key="index">
              <i-col span="4">
                <p class="start-body-title">{{ item.name }}评价:</p>
              </i-col>
              <i-col span="9">
                <Rate v-model="item.stars" disabled />
              </i-col>
              <i-col span="7">
                <p class="start-body-title">{{ item.createTime }}</p>
              </i-col>
              <i-col span="4">
                <Button class="com-del-btn" @click="commentReply(item, index)">回复</Button>
              </i-col>
              <i-col span="24" style="margin-bottom:10px;color: #c6c7c8;word-wrap: break-word;">点评内容：{{
                item.detail
              }}</i-col>

              <!-- 回复列表 -->
              <div v-for="(innerItem, index) in item.replayList" :key="index" style="margin-left:10px;" class="ivu-row">
                <i-col span="4">
                  <p class="start-body-title">{{ innerItem.name }}回复:</p>
                </i-col>
                <i-col span="9">
                  <Rate value=5 disabled />
                </i-col>
                <i-col span="7">
                  <p class="start-body-title">{{ innerItem.createTime }}</p>
                </i-col>
                <i-col span="4" v-if="innerItem.reagentCode == userId">
                  <Button class="com-del-btn" @click="commentDel(innerItem, index, item)">删除</Button>
                </i-col>
                <i-col span="24" style="margin-bottom:10px;color: #c6c7c8;word-wrap: break-word;">回复内容：{{
                  innerItem.detail
                }}</i-col>

              </div>

              <!-- 回复输入框 -->
              <i-col span="3" v-if="replayInputArr[index]">
                <Button type="primary" @click="replaySubmit(item, index)" style="width:100%">回复</Button>
              </i-col>
              <i-col span="17" v-if="replayInputArr[index]" style="margin-bottom:10px;">
                <i-input v-model="item.replayDetail" placeholder="请输入点评内容" clearable>
                  <!-- <span slot="prepend">
                      <Rate v-model="rateForm.value" />
                    </span> -->
                </i-input>
              </i-col>

            </Row>
          </i-col>
          <i-col span="18" v-else>
            <Row style="margin-top:20px;">
              <i-col span="24" style="height:100px;line-height:100px;">暂无评价</i-col>
            </Row>
          </i-col>
        </Row>
      </div>
    </Modal>

    <!-- 工作日志详情——已h销 -->
    <Modal v-model="modal4" :transfer="false"  footer-hide="true" @on-ok="revokedOK" @on-cancel="revokedCancel" width="680px"
      class="revokeModal" :mask-closable="false">
      <div slot="header" class="draftTitle">工作日志详情</div>
      <div>
        <!-- 制订详情 -->
        <div class="ar-title">工作日志制定详情:</div>
        <div style="width:100%; margin:0 0 20px 60px;">
          <Row style="margin-bottom:20px;">
            <i-col span="3">工作类型：</i-col>
            <i-col span="12">
              <div v-if="revokeList2.workBegin">{{ revokeList2.workBegin.workType }}</div>
            </i-col>
          </Row>
          <Row style="margin-bottom:20px;">
            <i-col span="3">工作时间：</i-col>
            <i-col span="12">
              <div  v-if="revokeList2.workBegin">{{ revokeList2.workBegin.workDay }} {{ revokeList2.workBegin.workTime }}</div>
            </i-col>
          </Row>
          <Row style="margin-bottom:20px;">
            <i-col span="3">电访情况：</i-col>
            <i-col span="12">
              <div>
                <span>计划{{ revokeList1.detailNum ? revokeList1.detailNum.planphonecount : 0 }}单-完成{{
                  revokeList1.detailNum
                    ? revokeList1.detailNum.donephonecount : 0
                }}单-超期{{
  revokeList1.detailNum ?
    revokeList1.detailNum.delayphonecount : 0
}}单</span>
                <Button type="primary" size="small" style="margin-left:5px;"
                  @click="linkToWorkRecord(revokeList1, '0')">工作记录</Button>
              </div>
            </i-col>
          </Row>
          <Row style="margin-bottom:20px;">
            <i-col span="3">面访情况：</i-col>
            <i-col span="12">
              <div>
                <span>计划{{ revokeList1.detailNum ? revokeList1.detailNum.plantalkcount : 0 }}单-完成{{
                  revokeList1.detailNum ?
                    revokeList1.detailNum.donetalkcount : 0
                }}单-超期{{
  revokeList1.detailNum ?
    revokeList1.detailNum.delaytalkcount : 0
}}单</span>
                <Button type="primary" size="small" style="margin-left:5px;"
                  @click="linkToWorkRecord(revokeList1, '1')">工作记录</Button>
              </div>
            </i-col>
          </Row>
          <Row style="margin-bottom:20px;">
            <i-col span="3">短信情况：</i-col>
            <i-col span="12">
              <div>
                <span>计划{{
                  revokeList1.detailNum ? revokeList1.detailNum.planmessagecount :
                    0
                }}单-完成{{
  revokeList1.detailNum ? revokeList1.detailNum.donemessagecount :
    0
}}单-超期{{ revokeList1.detailNum ? revokeList1.detailNum.delaymessagecount : 0 }}单</span>
                <Button type="primary" size="small" style="margin-left:5px;"
                  @click="linkToWorkRecord(revokeList1, '2')">工作记录</Button>
              </div>
            </i-col>
          </Row>
          <Row style="margin-bottom:20px;">
            <i-col span="3">网络情况：</i-col>
            <i-col span="12">
              <div>
                <span>计划{{ revokeList1.detailNum ? revokeList1.detailNum.plannetcount : 0 }}单-完成{{
                  revokeList1.detailNum
                    ?
                    revokeList1.detailNum.donenetcount : 0
                }}单-超期{{
  revokeList1.detailNum ?
    revokeList1.detailNum.delaynetcount : 0
}}单</span>
                <Button type="primary" size="small" style="margin-left:5px;"
                  @click="linkToWorkRecord(revokeList1, '3')">工作记录</Button>
              </div>
            </i-col>
          </Row>
          <Row style="margin-bottom:20px;">
            <i-col span="3">续期情况：</i-col>
            <i-col span="12">
              <div>
                <span>收费成功{{ revokeList1.detailNum ? revokeList1.detailNum.donefeecount : 0 }}单</span>
                <Button type="primary" size="small" style="margin-left:86px;"
                  @click="linkToWorkRecord(revokeList1, '4')">回访登记</Button>
              </div>
            </i-col>
          </Row>
          <Row style="margin-bottom:20px;">
            <i-col span="3">工作地点：</i-col>
            <i-col span="12">
              <div v-if="revokeList2.workBegin">{{ revokeList2.workBegin.workSite }}</div>
            </i-col>
          </Row>
          <Row style="margin-bottom:20px;">
            <i-col span="3">工作内容：</i-col>
            <i-col span="18">
              <!-- <div style="max-height:84px; overflow-x:hidden;"> -->
              <!-- <div class="omit" v-for ="(item,index) in revokeList1.expectEffect" :key="index">{{index+1}} 、{{item.expectEffect}}</div> -->
              <div class="omit" v-for="(item, index) in revokeList1.expectEffect" :key="index">{{ index + 1 }}
                、{{ item.expectEffect }}</div>
            </i-col>
          </Row>
          <Row style="margin-bottom:20px;">
            <i-col span="3">说明附件：</i-col>
            <i-col span="18">
              <!-- <div style="max-height:84px; overflow-x:hidden;"> -->
              <div>
                <div v-if="revokeList2.filesA && revokeList2.filesA.length > 0">
                  <p v-for="(item, index) in revokeList2.filesA" :key="index" class="see-btn omit"
                    @click="checkFile(item)">{{ item[1] }}</p>
                </div>
                <p v-else>暂无附件</p>
              </div>
            </i-col>
          </Row>
        </div>
        <!-- 回销详情 -->
        <div class="line"></div>
        <div class="ar-title">工作日志回销详情:</div>
        <div style="width:100%; margin:0 0 20px 60px;">
          <Row style="margin-bottom:20px;">
            <i-col span="3">工作类型：</i-col>
            <i-col span="12">
              <div>{{ revokeList2.workType }}</div>
            </i-col>
          </Row>
          <Row style="margin-bottom:20px;">
            <i-col span="3">完成时间：</i-col>
            <i-col span="12">
              <div>{{ revokeList2.workDay }} {{ revokeList2.workTime }}</div>
            </i-col>
          </Row>
          <Row style="margin-bottom:20px;">
            <i-col span="3">工作地点：</i-col>
            <i-col span="12">
              <div>{{ revokeList2.workSite }}</div>
            </i-col>
          </Row>
          <Row style="margin-bottom:20px;">
            <i-col span="3">完成情况：</i-col>
            <i-col span="18">
              <!-- <div style="max-height:84px; overflow-x:hidden;"> -->
              <!-- <div class="omit">{{revokeList2.expectEffect}}</div> -->
              <div class="omit" v-for="(item, index) in revokeList2.diaryA" :key="index">{{ index + 1 }}
                、{{ item.expectEffect }}</div>
            </i-col>
          </Row>
          <Row style="margin-bottom:20px;">
            <i-col span="3">说明附件：</i-col>
            <i-col span="18">
              <!-- <div style="max-height:84px; overflow-x:hidden;"> -->
              <div>
                <div v-if="revokeList2.files && revokeList2.files.length > 0">
                  <p v-for="(item, index) in revokeList2.files" :key="index" class="see-btn omit"
                    @click="checkFile(item)">{{ item[1] }}</p>
                </div>
                <p v-else>暂无附件</p>
              </div>
            </i-col>
          </Row>
        </div>
        <div class="start">
          <Row>
            <i-col span="4">
              <div class="start-title">领导评价:</div>
            </i-col>
            <i-col span="18" v-if="assessList.length > 0">
              <!-- <Row class="assess-t" v-for="(item,index) in assessList" :key="index">
                <i-col span="6">
                  <p class="start-body-title">{{item.name}}评价:</p>
                </i-col>
                <i-col span="8">
                  <Rate v-model="item.stars" disabled />
                </i-col>
                <i-col span="8" style="margin-top:5px;">{{item.detail}}</i-col>
              </Row> -->
              <Row class="assess-t" v-for="(item, index) in assessList" :key="index">
                <i-col span="4">
                  <p class="start-body-title">{{ item.name }}评价:</p>
                </i-col>
                <i-col span="9">
                  <Rate v-model="item.stars" disabled />
                </i-col>
                <i-col span="7">
                  <p class="start-body-title">{{ item.createTime }}</p>
                </i-col>
                <i-col span="4">
                  <Button class="com-del-btn" @click="commentReply(item, index)">回复</Button>
                </i-col>
                <i-col span="24" style="margin-bottom:10px;color: #c6c7c8;word-wrap: break-word;">点评内容：{{
                  item.detail
                }}</i-col>

                <!-- 回复列表 -->
                <div v-for="(innerItem, index) in item.replayList" :key="index" style="margin-left:10px;"
                  class="ivu-row">
                  <i-col span="4">
                    <p class="start-body-title">{{ innerItem.name }}回复:</p>
                  </i-col>
                  <i-col span="9">
                    <Rate value=5 disabled />
                  </i-col>
                  <i-col span="7">
                    <p class="start-body-title">{{ innerItem.createTime }}</p>
                  </i-col>
                  <i-col span="4" v-if="innerItem.reagentCode == userId">
                    <Button class="com-del-btn" @click="commentDel(innerItem, index, item)">删除</Button>
                  </i-col>
                  <i-col span="24" style="margin-bottom:10px;color: #c6c7c8;word-wrap: break-word;">回复内容：{{
                    innerItem.detail
                  }}</i-col>

                </div>

                <!-- 回复输入框 -->
                <i-col span="3" v-if="replayInputArr[index]">
                  <Button type="primary" @click="replaySubmit(item, index)" style="width:100%">回复</Button>
                </i-col>
                <i-col span="17" v-if="replayInputArr[index]" style="margin-bottom:10px;">
                  <i-input v-model="item.replayDetail" placeholder="请输入点评内容" clearable>
                    <!-- <span slot="prepend">
                      <Rate v-model="rateForm.value" />
                    </span> -->
                  </i-input>
                </i-col>

              </Row>
            </i-col>
            <i-col span="18" v-else>
              <Row style="margin-top:20px;">
                <i-col span="24" style="height:100px;line-height:100px;">暂无评价</i-col>
              </Row>
            </i-col>
          </Row>
        </div>
      </div>
    </Modal>
    <!-- 工作日志详情——重新回销 -->
    <Modal v-model="modal5" :transfer="false"  footer-hide="true" @on-ok="revokedOK" @on-cancel="revokedCancel" width="680px"
      class="revokeModal" :mask-closable="false">
      <div slot="header" class="draftTitle">工作日志详情</div>
      <Row style="margin-bottom:20px; margin-top:10px;">
        <i-col span="4" class="user-title" style="margin-right:10px;">{{ infoList.name }}</i-col>
        <i-col span="4" class="user-list">
          <Icon type="md-browsers" />
          {{ infoList.employeeNO }}
        </i-col>
        <i-col span="4" class="user-list">
          <Icon type="md-person" />
          {{ infoList.roleName }}
        </i-col>
        <i-col span="10" class="user-list">
          <Icon type="ios-pin" />
          {{ infoList.managecomName }}
        </i-col>
      </Row>
      <div>
        <!-- 制订详情 -->
        <div class="ar-title">工作日志制定详情:</div>
        <div style="width:100%; margin:0 0 20px 60px;">
          <Row style="margin:20px 0;">
            <i-col span="3">工作类型：</i-col>
            <i-col span="12">
              <div  v-if="revokeList2.workBegin">{{ revokeList2.workBegin.workType }}</div> 
            </i-col>
          </Row>
          <Row style="margin-bottom:20px;">
            <i-col span="3">工作时间：</i-col>
            <i-col span="12">
              <div v-if="revokeList2.workBegin">{{ revokeList2.workBegin.workDay }} {{ revokeList2.workBegin.workTime }}</div>
            </i-col>
          </Row>
          <Row style="margin-bottom:20px;">
            <i-col span="3">电访情况：</i-col>
            <i-col span="12">
              <div>
                <span>计划{{ revokeList1.detailNum ? revokeList1.detailNum.planphonecount : 0 }}单-完成{{
                  revokeList1.detailNum
                    ? revokeList1.detailNum.donephonecount : 0
                }}单-超期{{
  revokeList1.detailNum ?
    revokeList1.detailNum.delayphonecount : 0
}}单</span>
                <Button type="primary" size="small" style="margin-left:5px;"
                  @click="linkToWorkRecord(revokeList1, '0')">工作记录</Button>
              </div>
            </i-col>
          </Row>
          <Row style="margin-bottom:20px;">
            <i-col span="3">面访情况：</i-col>
            <i-col span="12">
              <div>
                <span>计划{{ revokeList1.detailNum ? revokeList1.detailNum.plantalkcount : 0 }}单-完成{{
                  revokeList1.detailNum ?
                    revokeList1.detailNum.donetalkcount : 0
                }}单-超期{{
  revokeList1.detailNum ?
    revokeList1.detailNum.delaytalkcount : 0
}}单</span>
                <Button type="primary" size="small" style="margin-left:5px;"
                  @click="linkToWorkRecord(revokeList1, '1')">工作记录</Button>
              </div>
            </i-col>
          </Row>
          <Row style="margin-bottom:20px;">
            <i-col span="3">短信情况：</i-col>
            <i-col span="12">
              <div>
                <span>计划{{
                  revokeList1.detailNum ? revokeList1.detailNum.planmessagecount :
                    0
                }}单-完成{{
  revokeList1.detailNum ? revokeList1.detailNum.donemessagecount :
    0
}}单-超期{{ revokeList1.detailNum ? revokeList1.detailNum.delaymessagecount : 0 }}单</span>
                <Button type="primary" size="small" style="margin-left:5px;"
                  @click="linkToWorkRecord(revokeList1, '2')">工作记录</Button>
              </div>
            </i-col>
          </Row>
          <Row style="margin-bottom:20px;">
            <i-col span="3">网络情况：</i-col>
            <i-col span="12">
              <div>
                <span>计划{{ revokeList1.detailNum ? revokeList1.detailNum.plannetcount : 0 }}单-完成{{
                  revokeList1.detailNum
                    ?
                    revokeList1.detailNum.donenetcount : 0
                }}单-超期{{
  revokeList1.detailNum ?
    revokeList1.detailNum.delaynetcount : 0
}}单</span>
                <Button type="primary" size="small" style="margin-left:5px;"
                  @click="linkToWorkRecord(revokeList1, '3')">工作记录</Button>
              </div>
            </i-col>
          </Row>
          <Row style="margin-bottom:20px;">
            <i-col span="3">续期情况：</i-col>
            <i-col span="12">
              <div>
                <span>收费成功{{ revokeList1.detailNum ? revokeList1.detailNum.donefeecount : 0 }}单</span>
                <Button type="primary" size="small" style="margin-left:86px;"
                  @click="linkToWorkRecord(revokeList1, '4')">回访登记</Button>
              </div>
            </i-col>
          </Row>
          <!-- <Row style="margin-bottom:20px;">
            <i-col span="3">转保情况：</i-col>
            <i-col span="12">
              <div>
                <span>转保成功 //TODO待联调 单</span>
                <Button type="primary" size="small" style="margin-left:86px;"
                  @click="linkToWorkRecord(revokeList1, '4')">回访登记</Button>
              </div>
            </i-col>
          </Row> -->
          <Row style="margin-bottom:20px;">
            <i-col span="3">工作地点：</i-col>
            <i-col span="12">
              <div>{{ revokeList1.workSite }}</div>
            </i-col>
          </Row>
          <Row style="margin-bottom:20px;">
            <i-col span="3">工作内容：</i-col>
            <i-col span="18">
              <!-- <div style="max-height:84px; overflow-x:hidden;"> -->
              <!-- <div class="omit" v-for ="(item,index) in revokeList1.expectEffect" :key="index">{{index+1}} 、{{item.expectEffect}}</div> -->
              <div class="omit" v-for="(item, index) in revokeList1.expectEffect" :key="index">{{ index + 1 }}
                、{{ item.expectEffect }}</div>
            </i-col>
          </Row>
          <Row style="margin-bottom:20px;">
            <i-col span="3">说明附件：</i-col>
            <i-col span="18">
              <!-- <div style="max-height:84px; overflow-x:hidden;"> -->
              <div>
                <div v-if="revokeList1.smallFile != '暂无附件'">
                  <p v-for="(item, index) in revokeList1.files" :key="index" class="see-btn omit"
                    @click="checkFile(item)">{{ item[1] }}</p>
                </div>
                <p v-if="revokeList1.smallFile == '暂无附件'">暂无附件</p>
              </div>
            </i-col>
          </Row>
        </div>
        <!-- 回销详情 -->
        <Divider />
        <div class="ar-title">工作日志回销详情:</div>
        <div style="width:100%; margin:20px 0 20px 60px;">
          <Form ref="revokeForm" :model="revokeForm" :rules="draftRoleValidate2">
            <Row>
              <i-col span="3" style="height:32px; line-height:32px; font-size:14px;">工作类型：</i-col>
              <i-col span="12">
                <FormItem prop="revokeNews">
                  <Select v-model="revokeForm.revokeNews" clearable style="width: 168px;">
                    <Option v-for="item in newsList" :key="item.key" :value="item.key">{{ item.value }}</Option>
                  </Select>
                </FormItem>
              </i-col>
            </Row>
            <Row>
              <i-col span="3" style="height:32px; line-height:32px; font-size:14px;">完成时间：</i-col>
              <i-col span="7">
                <FormItem prop="revokeDate">
                  <DatePicker type="date" v-model="revokeForm.revokeDate" placeholder="请输入完成日期" @on-change="dateChange2"
                    :readonly="true" style="width:168px;" format="yyyy-MM-dd"></DatePicker>
                </FormItem>
              </i-col>
              <i-col span="6">
                <FormItem prop="revokeTime">
                  <TimePicker type="time" format="HH:mm" v-model="revokeForm.revokeTime" placeholder="请输入完成时间"
                    style="width: 168px" :readonly="true"></TimePicker>
                </FormItem>
              </i-col>
            </Row>
            <Row>
              <i-col span="3" style="height:32px; line-height:32px; font-size:14px;">工作地点：</i-col>
              <i-col span="16">
                <FormItem prop="revokeSite">
                  <Input type="text" v-model="revokeForm.revokeSite" placeholder="请输入工作地点" style="width: 392px" />
                </FormItem>
              </i-col>
            </Row>
            <Row>
              <i-col span="3" style="height:32px; line-height:32px; font-size:14px;">完成情况：</i-col>
              <i-col span="18">
                <FormItem v-for="(item, index) in revokeForm.expectEffect2" :key="index" prop="expectEffect2"
                  style="margin-bottom:10px">
                  <span style="display:inline-block;width:20px">{{ index + 1 + '、' }}</span>
                  <Input type="text" v-model="item.expectEffect" style="width: 369px" />
                  <Icon v-if="index > 0" type="ios-remove-circle-outline" size="24"
                    @click="deleteExpectEffect2(index)" />
                </FormItem>
                <div style="width: 392px;text-align:center;margin-bottom:20px">
                  <Icon type="md-add-circle" size="24" @click="addExpectEffect2" />
                </div>
              </i-col>
            </Row>
            <Row>
              <i-col span="3" style="height:32px; line-height:32px; font-size:14px;">说明附件：</i-col>
              <i-col span="18">
                <FormItem prop="leaveFile">
                  <Uploadv multiple ref="upload6" type="drag" :format="['pdf', 'mp4', 'xls', 'xlsx', 'png', 'jpg']"
                    :on-format-error="handleFormatError2" :before-upload="handleUpload2" :show-upload-list="false"
                    :on-success="uploadSuccess2" :on-error="uploadFail2" :headers="{
                      Authorization: tocken,
                    }" name="multipartFile" :data="{ applyNo: '1' }" :action="action" style="width:392px">
                    <Icon type="ios-cloud-upload" size="52" style="color: #3399ff"></Icon>
                    <p>点击或将文件拖拽到这里上传</p>
                    <p style="color:rgba(0,0,0,0.43)">支持扩展名：.pdf .mp4.xls.xlsx.jpg...</p>
                  </Uploadv>
                  <div v-for="(item, index) in revokeList2.files" :key="index">
                    <div>
                      <Icon type="md-attach" style="transform:rotate(90deg);" />
                      &nbsp;{{ item[1]}}
                      <span @click="delectRecordFile(item[0], index)" class="deleteFile">X</span>
                    </div>

                  </div>
                  <div v-for="(item, index) in file2" :key="index">
                    <div>
                      <Icon type="md-attach" style="transform:rotate(90deg);" />
                      &nbsp;{{ item.name }}
                      <span @click="delectFile2(item.keyID)" class="deleteFile">X</span>
                    </div>
                  </div>
                </FormItem>
              </i-col>
            </Row>
            <Row style="margin: 0 0 0 240px;">
              <FormItem style="text-align:center">
                <Button type="primary" :loading="draftLoading2" @click="reRecord">提交</Button>
              </FormItem>
            </Row>
          </Form>
        </div>
        <Divider />
        <div style="width:95%;margin-left: 20px;">
          <div class="mini-title"> 退回信息</div>
          <div v-for="(item, index) in returnList" :key="index"
            style="display:flex;justify-content: space-between;margin: 10px 0;">
            <div>操作人：{{ item.name }}</div>
            <div style="width:200px">退回原因：{{ item.cause }}</div>
            <div>退回时间：{{ item.returnTime }}</div>
          </div>
          <div class="mini-title">点评信息</div>
          <div v-if="assessList.length > 0">
            <div v-for="(item, index) in assessList" :key="index">{{ item.name }}点评：
              <Rate :value="item.stars" disabled /><span style="color:#9fa0a1">{{ item.detail }}</span>
            </div>
          </div>
          <div v-else>暂无点评</div>
        </div>
      </div>
    </Modal>
    <!-- 播放视频 -->
    <Modal footer-hide="true" :value="videoModal" :mask-closable="true" @on-visible-change="modalVisibleChange"
      :closable="false">
      <span class="photoModal">
        <video :src="photoItem" controls id="video1" controlslist="nodownload" />
      </span>
    </Modal>

    <Button @click="info" v-if="false"></Button>
  </div>
</template>


<script>
import util from "../../../util/util";
export default {
  name: "workLogging",
  data() {
    return {
      recordFile: [],
      newApplyNo: '',
      btn: ["primary", "default", "default"],
      queryForm: {
        workType: null,
        workDate: ["", ""]
      },
      newsList: [
        { key: "1", value: "日报" },
        { key: "2", value: "宣导计划" },
        { key: "3", value: "服务计划" },
        { key: "4", value: "业务操作" },
        { key: "5", value: "其他" },
      ],
      workLogList: [],
      queryLoading: false,
      // 工作日志制定
      modal1: false,
      draftForm: {
        draftNews: "",
        draftDate: "",
        draftTime: "",
        draftSite: "",
        expectEffect: [{ expectEffect: '' }],
        // expectEffect: [{workRecord:''}],
        files: ""
      },
      draftLoading1: false,
      // 校验
      draftRoleValidate1: {
        draftNews: [
          { required: true, message: "工作类型不能为空", trigger: "change" }
        ],
        draftDate: [
          { required: true, message: "工作日期不能为空", trigger: "change" }
        ],
        draftTime: [
          { required: true, message: "工作时间不能为空", trigger: "change" }
        ],
        draftSite: [
          { required: true, message: "工作地点不能为空", trigger: "change" }
        ],
        expectEffect: [
          { required: true, type: 'array', message: "工作内容不能为空", trigger: "change" }
        ]
      },
      // 文件上传1号--工作日志制定
      action: null,
      tocken: null,
      fileLoading1: false,
      file1: [],
      delectFiles1: [],
      fileIndex1: 0,
      // 工作日志回销
      modal2: false,
      revokeForm: {
        revokeNews: "",
        revokeDate: "",
        revokeTime: "",
        revokeSite: "",
        expectEffect2: [{ expectEffect: '' }]
      },
      draftLoading2: false,
      // 校验
      draftRoleValidate2: {
        revokeNews: [
          { required: true, message: "工作类型不能为空", trigger: "change" }
        ],
        revokeDate: [
          { required: true, type: 'date', message: "完成日期不能为空", trigger: "change" }
        ],
        revokeTime: [
          { required: true, message: "完成时间不能为空", trigger: "change" }
        ],
        revokeSite: [
          { required: true, message: "工作地点不能为空", trigger: "change" }
        ],
        // expectEffect2: [
        //   { required: true, message: "完成情况不能为空", trigger: "change" }
        // ]
      },
      // 文件上传2号-----工作日志回销
      fileLoading2: false,
      file2: [],
      delectFiles2: [],
      fileIndex2: 0,
      modal3: false,
      uncancelledForm: {},
      modal4: false,
      revokedForm: {},
      startForm: {},
      // 分页
      total: 0,
      pageSize: 8,
      pageIndex: 1,
      pageObj: null,
      // 状态
      status: null,
      statusObj: null,
      userId: "",
      dustyId: "",
      // 详情 -- 未回销
      revokeList1: [],
      // 详情 -- 已回销
      revokeList2: [],
      // 评价
      assessList: [],
      fg: 0,
      videoModal: false,
      //存回复提交框的状态
      replayInputArr: [],
      //点击的简介
      clickItem: {},
      clickIndex: 0,
      // useragentcode:'',
      jsonData: {},
      modal5: false,
      infoList: [],
      returnList: [],
    };
  },
  methods: {
    addExpectEffect() {
      this.draftForm.expectEffect.push({ expectEffect: '' })
    },
    deleteExpectEffect(index) {
      this.draftForm.expectEffect.splice(index, 1)
    },
    addExpectEffect2() {
      this.revokeForm.expectEffect2.push({ expectEffect: '' })
    },
    deleteExpectEffect2(index) {
      this.revokeForm.expectEffect2.splice(index, 1)
    },
    // 回复评论
    commentReply(item, index) {
      this.replayInputArr[index] = true;
      this.$forceUpdate();
      // console.log(item, this.replayInputArr[index])

      this.logDetail(this.clickItem, this.clickIndex)
    },
    //提交回复
    replaySubmit(item, index) {
      //能获取到回复内容了
      // console.log(item.replayDetail,item,index)
      // this.logDetail(this.clickItem, this.clickIndex)
      let parm = {
        aID: this.clickItem.id,
        estimateId: item.id,
        stars: "5",
        detail: item.replayDetail,
        reagentCode: sessionStorage.getItem("useragentcode")
        // reagentCode:this.useragentcode
      }
      this.api.addWorkEstimateReplay(parm).then(res => {
        if (res.code == 200) {
          this.logDetail(this.clickItem, this.clickIndex)
          // this.clickItem[this.clickIndex].replayDetail = ""
          this.replayInputArr[index] = false;
          this.$forceUpdate();

          this.info("回复成功");
        } else {
          this.info(res.msg);
          this.clickItem[this.clickIndex].replayDetail = ""
          this.replayInputArr[index] = false;
        }
        // console.log(this.workLogList);
      });
    },
    //删除回复
    commentDel(inner, index, item) {
      // console.log(inner, index, item)
      this.logDetail(this.clickItem, this.clickIndex)
      // delWorkEstimateReplay
      let obj = {
        estimateId: inner.id,
        aId: item.id
      }
      this.api.delWorkEstimateReplay(obj).then(res => {
        if (res.code == 200) {
          this.logDetail(this.clickItem, this.clickIndex)
          this.info("删除成功");
        } else {
          this.info(res.msg);
        }
      })
    },
    //已回销关闭弹窗
    revokedCancel() {
      this.replayInputArr = [];
      this.assessList = [];
      // this.submitForm(0)
    },
    uncancelledCancel() {
      this.replayInputArr = [];
      this.assessList = [];
    },
    //跳转去工作记录
    linkToWorkRecord(n, type) {
      console.log(n);
      console.log(n.workDay, "1");
      // this.modal3 = false
      // // this.modal4 = false
      window.sessionStorage.setItem("flag", "1")
      if (type != "4") {
        this.$router.push({
          // name: "workRecordCheckingList",
          path: "workRecordCheckingList",
          query: {
            row: n,
            reagentCode: n.reagentCode,
            appointeddate: n.makeDay,
            type: type,
            flag: "1"
          }
        });
      } else {
        this.$router.push({
          // name: "workRecordReturnList",
          path: "workRecordReturnList",
          query: {
            row: n,
            reagentCode: n.reagentCode,
            appointeddate: n.makeDay,
            type: type,
            flag: "1"
          }
        });
      }
    },
    // 日期改变
    workDateChange(chooseDate, currentDate) {
      this.queryForm.workDate = chooseDate;
    },
    dateChange(chooseDate, currentDate) {
      this.draftForm.draftDate = chooseDate;
    },
    dateChange2(chooseDate, currentDate) {
      this.revokeForm.revokeDate = chooseDate;
    },
    // 提示语
    info(tip) {
      this.$Message.info(tip);
    },
    // 查询
    submitForm(t) {
      this.pageIndex = 1;
      this.btn = ["primary", "default", "default"];
      if (t != 1) {
        this.queryLoading = true;
      }

      this.workLogList = [];
      let startDay = this.queryForm.workDate[0];
      let endDay = this.queryForm.workDate[1];
      let obj = {
        workType: this.queryForm.workType,
        workBeginDay: startDay,
        workEndDay: endDay,
        status: null,
        managecom: "",
        reagentCode: this.userId,
        index: 1,
        pageSize: this.pageSize
      };
      // console.log(obj)
      this.pageObj = obj;
      this.statusObj = obj;
      this.$router.push({
        path: this.$router.path,
        query: this.pageObj
      })
      this.api.selectWorkDiary(obj).then(res => {
        if (res.code == 200) {
          // this.Echo()
          if (res.data.records) {
            // this.workLogList = res.data.records;
            res.data.records.forEach(element => {
              element["smallFile"] = "";
              if (element.files) {
                if (element.files.length > 0) {
                  if (element.files.length == 1) {
                    element["smallFile"] = element.files[0][1];
                  } else {
                    for (let m = 0; m < element.files.length; m++) {
                      if (m < element.files.length - 1) {
                        element["smallFile"] += element.files[m][1] + "、";
                      } else {
                        element["smallFile"] += element.files[m][1];
                      }
                    }
                  }
                } else {
                  element["smallFile"] = "暂无附件";
                }
              }
              this.workLogList.push(element);

            });
            console.log(this.workLogList, "11111111111111")
            this.DustyQuery()
            // console.log("0")
            // console.log(this.workLogList)
            this.total = res.data.total;
            this.queryLoading = false;
            if (t != 1) {
              this.info(res.msg);
            }
          } else {
            this.info("暂无数据！");
            this.workLogList = [];
            this.queryLoading = false;
          }
        } else {
          this.info(res.msg);
          this.workLogList = [];
          this.queryLoading = false;
        }
        // console.log(this.workLogList);
      });
    },
    DustyQuery() {
      for (let i = 0; i < this.workLogList.length; i++) {
        let parm = {
          reagentcode: this.workLogList[i].reagentCode,
          appointeddate: this.workLogList[i].makeDay
        }
        console.log(parm, "parm");
        // this.api.selectWorkDoneState(parm).then(res => {
        //   if (res.code == 200) {
        //     if (res.data) {
        //       this.workLogList[i].detailNum = res.data
        //       this.$forceUpdate();
        //     }
        //   }
        // });
      }
    },
    // 重置
    resetForm() {
      this.$refs.queryForm.resetFields();
      this.queryLoading = false;
    },
    // 翻页
    pageChange(pageIndex) {
      this.pageIndex = pageIndex;
      this.submitPage();
    },
    submitPage() {
      this.workLogList = [];
      this.pageObj.index = this.pageIndex;
      this.$router.push({
        path: this.$router.path,
        query: this.pageObj
      })
      this.api.selectWorkDiary(this.pageObj).then(res => {
        if (res.code == 200) {
          // this.Echo()
          if (res.data.records) {
            // this.workLogList = res.data.records;
            res.data.records.forEach(element => {
              element["smallFile"] = "";
              if (element.files) {
                if (element.files.length > 0) {
                  if (element.files.length == 1) {
                    element["smallFile"] = element.files[0][1];
                  } else {
                    for (let m = 0; m < element.files.length; m++) {
                      if (m < element.files.length - 1) {
                        element["smallFile"] += element.files[m][1] + "、";
                      } else {
                        element["smallFile"] += element.files[m][1];
                      }
                    }
                  }
                } else {
                  element["smallFile"] = "暂无附件";
                }
              }

              this.workLogList.push(element);
            });
            this.DustyQuery()

            this.total = res.data.total;
            this.queryLoading = false;
          } else {
            this.info("暂无数据！");
            this.workLogList = [];
            this.queryLoading = false;
          }
        } else {
          this.info(res.msg);
          this.workLogList = [];
          this.queryLoading = false;
        }
      });
    },
    // 全部->未回销->已回销-----状态切换
    buttonClick(idx) {
      this.workLogList = [];
      this.statusObj.index = 1;
      if (idx == 0) {
        console.log(idx, "全部")
        // 全部
        this.btn = ["primary", "default", "default"];
        this.statusObj.status = null;
        this.$router.push({
          path: this.$router.path,
          query: this.statusObj
        })
        this.api.selectWorkDiary(this.statusObj).then(res => {
          if (res.code == 200) {
            // this.Echo()
            if (res.data.records) {
              res.data.records.forEach(element => {
                element["smallFile"] = "";
                if (element.files) {
                  if (element.files.length > 0) {
                    if (element.files.length == 1) {
                      element["smallFile"] = element.files[0][1];
                    } else {
                      for (let m = 0; m < element.files.length; m++) {
                        if (m < element.files.length - 1) {
                          element["smallFile"] += element.files[m][1] + "、";
                        } else {
                          element["smallFile"] += element.files[m][1];
                        }
                      }
                    }
                  } else {
                    element["smallFile"] = "暂无附件";
                  }
                }

                this.workLogList.push(element);
                this.DustyQuery()
              });
              this.total = res.data.total;
            } else {
              this.info("暂无数据！");
              this.workLogList = [];
            }
          } else {
            this.info(res.msg);
            this.workLogList = [];
          }
        });
      } else if (idx == 1) {
        // 未回销
        this.btn = ["default", "primary", "default"];
        this.statusObj.status = "1";
        this.$router.push({
          path: this.$router.path,
          query: this.statusObj
        })
        this.api.selectWorkDiary(this.statusObj).then(res => {
          if (res.code == 200) {
            // this.Echo()
            if (res.data.records) {
              res.data.records.forEach(element => {
                element["smallFile"] = "";
                if (element.files) {
                  if (element.files.length > 0) {
                    if (element.files.length == 1) {
                      element["smallFile"] = element.files[0][1];
                    } else {
                      for (let m = 0; m < element.files.length; m++) {
                        if (m < element.files.length - 1) {
                          element["smallFile"] += element.files[m][1] + "、";
                        } else {
                          element["smallFile"] += element.files[m][1];
                        }
                      }
                    }
                  } else {
                    element["smallFile"] = "暂无附件";
                  }
                }

                this.workLogList.push(element);
                this.DustyQuery()
              });
              this.total = res.data.total;
            } else {
              this.info("暂无数据！");
              this.workLogList = []; z
            }
          } else {
            this.info(res.msg);
            this.workLogList = [];
          }
        });
        this.DustyQuery()
      } else {
        // 已回销
        this.btn = ["default", "default", "primary"];
        this.statusObj.status = "2";
        this.$router.push({
          path: this.$router.path,
          query: this.statusObj
        })
        this.api.selectWorkDiary(this.statusObj).then(res => {
          if (res.code == 200) {
            // this.Echo()
            if (res.data.records) {
              res.data.records.forEach(element => {
                element["smallFile"] = "";
                if (element.files) {
                  if (element.files.length > 0) {
                    if (element.files.length == 1) {
                      element["smallFile"] = element.files[0][1];
                    } else {
                      for (let m = 0; m < element.files.length; m++) {
                        if (m < element.files.length - 1) {
                          element["smallFile"] += element.files[m][1] + "、";
                        } else {
                          element["smallFile"] += element.files[m][1];
                        }
                      }
                    }
                  } else {
                    element["smallFile"] = "暂无附件";
                  }
                }

                this.workLogList.push(element);
                this.DustyQuery()
              });
              this.total = res.data.total;
            } else {
              this.info("暂无数据！");
              this.workLogList = [];
            }
          } else {
            this.info(res.msg);
            this.workLogList = [];
          }
        });
        this.DustyQuery()
      }
    },
    // 工作日志详情 
    logDetail(row, index, flag) {
      // flag--是否是重新回销
      // this.revokeList1.detailNum = this.clickItem.detailNum
      console.log(row, index);
      this.clickItem = row;
      this.clickIndex = index;
      if (row.status == "未回销") {
        // 详情 -- 未回销
        this.revokeList1 = row;
        this.revokeList1.detailNum = row.detailNum
        let newParm = {
          dustyId: row.dustyId,
          aId: row.id
        }
        // 领导评价
        this.api.selectWorkDiaryEstimate(newParm).then(res => {
          if (res.code == 200) {
            console.log(res, "resresres")
            if (res.data) {
              this.assessList = res.data;
              this.assessList.forEach((element, index) => {
                element.stars = Number(element.stars);
                element.showReplayEdit = false;
                element.replayDetail = "";
                //回复数据
                this.api.selectWorkEstimateReplay({ estimateId: element.id }).then(res => {
                  if (res.code == 200) {
                    element.replayList = res.data;
                    this.$forceUpdate();
                  } else {
                    this.info("查询回复失败");
                  }
                })
                // this.$forceUpdate();
                this.replayInputArr.push(false)
              });
              //已查看评论
              let newParmas = {
                // dustyId: row.id,
                aId: row.id,
                isRead: this.workLogList[index].isRead
              }
              if (this.workLogList[index].isRead == "0" || this.workLogList[index].isRead == "2") {
                this.api.updateWorkDiaryRead(newParmas).then(res => {
                  if (res.code == 200) {
                    this.workLogList[index].isRead = this.workLogList[index].isRead == "0" ? "1" : "3"
                  }
                });
              }
            } else {
              this.workLogList[index].isRead = "";
              this.assessList = [];
            }
          } else {
            this.assessList = [];
            this.info(res.msg);
          }
        });
        this.modal3 = true;
      } else {
        /**详情 -- 已回销*/
        console.log("已回销123")
        let newParmId = {
          dustyId: row.dustyId,
          id: row.id
        }
        this.api.getOneWorkDiary(newParmId).then(res => {
          if (res.code == 200) {
            if (res.data != null) {
              // this.revokeList1 = res.data;
              this.revokeList1 = row;
              this.revokeList2 = res.data;
              if (row.status == "重新回销") {
                this.revokeForm = {
                  revokeNews: res.data.workType,
                  revokeDate: new Date(res.data.workDay),
                  revokeTime: res.data.workTime,
                  revokeSite: res.data.workSite,
                  expectEffect2: res.data.diaryA
                }
              }
              this.revokeList1.detailNum = row.detailNum
              this.newsList.forEach(item=>{
                if(item.key == res.data.workType){
                  this.revokeList2.workType = item.value
                }
                if(item.key == res.data.workBegin.workType){ 
                  this.revokeList2.workBegin.workType = item.value
                }  
              })  
              // this.newsList[
              //   this.revokeList1.workType - 1
              // ].value;
              if (!this.revokeList2.files[0]) {
                this.revokeList2["smallFile"] = "暂无附件";
              } else {
                this.revokeList2["smallFile"] = this.revokeList2.files;
              }
            } else {
              this.revokeList2 = [];
              this.info("暂无数据");
            }
          } else {
            this.revokeList1 = [];
            this.info(res.msg);
          }
        });
        // // //已回销时的详情
        // if (row.status == "已回销") {
        //   this.revokeList2 = row;
        // }

        // 领导评价
        let newParm = {
          dustyId: row.dustyId,
          aId: row.id
        }
        this.api.selectWorkDiaryEstimate(newParm).then(res => {
          if (res.code == 200) {
            if (res.data) {
              this.assessList = res.data;
              this.assessList.forEach((element, index) => {
                element.stars = Number(element.stars);
                element.showReplayEdit = false;
                element.replayDetail = "";

                //回复
                this.api.selectWorkEstimateReplay({ estimateId: element.id }).then(res => {
                  if (res.code == 200) {
                    //待联调
                    element.replayList = res.data;
                    this.$forceUpdate();
                    // console.log(element.replayList)


                    if (element.replayList.length > 0) {
                      // let newParmasRe = {
                      //   dustyId: row.dustyId,
                      //   aId: row.id
                      // }
                      // this.api.updateWorkDiaryReadReplay(newParmasRe).then(res => {
                      //   if (res.code == 200) {
                      //     // this.workLogList[index].isRead = "1";
                      //     if(this.workLogList[index].isRead == "0"){
                      //       this.workLogList[index].isRead = "1"
                      //     }else if(this.workLogList[index].isRead == "2"){
                      //       this.workLogList[index].isRead = "3"
                      //     }
                      //     // console.log("ioioioui:"+this.workLogList[index].isRead)
                      //   }
                      // });
                    }

                  } else {
                    this.info("查询回复失败");
                  }
                })
                // this.$forceUpdate();
                this.replayInputArr.push(false)
              });


              //已查看评论
              let newParmas = {
                // dustyId: row.id,
                aId: row.id,
                isRead: this.workLogList[index].isRead
              }
              if (this.workLogList[index].isRead == "0" || this.workLogList[index].isRead == "2") {
                this.api.updateWorkDiaryRead(newParmas).then(res => {
                  if (res.code == 200) {
                    this.workLogList[index].isRead = this.workLogList[index].isRead == "0" ? "1" : "3"
                  }
                });
              }
              //已查看回复
              // let newParmasRe = {
              //   dustyId: row.dustyId,
              //   aId: row.id
              // }
              // if(this.workLogList[index].isRead == "2"){
              //   this.api.updateWorkDiaryReadReplay(newParmasRe).then(res => {
              //     if (res.code == 200) {
              //         this.workLogList[index].isRead = "3"

              //     }
              //   });
              // }

            } else {
              this.workLogList[index].isRead = "";
              this.assessList = [];
            }
          } else {
            this.assessList = [];
            this.info(res.msg);
          }
        });
        this.modal4 = !flag;
        console.log(this.modal4);
      }
    },

    // 关闭视频弹窗
    modalVisibleChange(value) {
      if (!value) {
        this.videoModal = false;
        let video1 = document.getElementById("video1");
        video1.pause();
      }
    },

    //查看或播放
    checkFile(item) {
      let typeFg = item[1].split(".");
      typeFg = typeFg[typeFg.length - 1];
      console.log(item)

      // console.log(typeFg);
      if (typeFg == "pdf") {
        // 查看PDF
        let url = item[3];
        window.open(url + "#toolbar=0");
      } else if (typeFg == "mp4") {
        // 播放视频
        this.videoModal = true;
        this.photoItem = item[3];
      } else {
        let url = item[3];
        window.open(url)
        console.log(item)
      }
    },

    // 工作日志制定
    handleSubmit1() {
      this.draftForm.expectEffect.forEach((item, index) => {
        item.orderNo = index + 1
      })
      this.$refs.draftForm.validate(valid => {
                console.log('this.$refs.upload1.data',this.$refs,this.$refs.upload1,this.$refs.upload1.data);
        if (valid) {
          // this.draftLoading1 = true;
          let obj = {
            workType: this.draftForm.draftNews,
            workDay: this.draftForm.draftDate,
            workTime: this.draftForm.draftTime,
            workSite: this.draftForm.draftSite,
            // expectEffect: this.draftForm.expectEffect,
            jobContent: this.draftForm.expectEffect,
            status: "1",
            dustyId: null, //回销时调用
            id: this.userId,
          };
          // 删除文件
          if (this.deleteFiles1) {
            this.deleteFiles1.forEach(element => {
              if (element.id) {
                let obj = {
                  id: element.id
                };
                this.api.deleteAttachment(obj).then(res => {
                  if (res.code == 200) {
                  } else {
                    this.info(res.msg);
                    return false;
                  }
                });
              }
            });
          }
          this.api.addUerWorkDiary(obj).then(res => {
            console.log("11111")
            if (res.code == 200 && res.data != null) {
              this.draftForm.expectEffect = []
              this.newApplyNo = ''
              if (res.data) {
                console.log('this.$refs.upload1.data',this.$refs.upload1,this.$refs.upload1.data);
                this.$refs.upload1.applyNo = res.data;
                this.newApplyNo = res.data;
                // this.$nextTick(()=>{
                this.upload1();
                // })
                this.modal1 = false

              } else {
                this.draftForm.expectEffect = []
                this.info("工作日志制定失败");
              }
            } else {
              this.draftForm.expectEffect = []
              this.draftLoading1 = false;
              this.info(res.msg);
            }
          });


        }
      });
    },
    // 制定取消
    handleReset1() {
      this.modal1 = false;
      this.draftLoading1 = false;
      this.$refs.draftForm.resetFields();
      this.file1 = [];
      // Object.assign(this.$data.draftForm,this.$options.data().draftForm)
    },
    // 回销取消
    handleReset2() {
      this.fg = 0;
      this.file2 = [];
      // Object.assign(this.$data.revokeForm,this.$options.data().revokeForm)
      this.modal2 = false;
      this.$refs.revokeForm.resetFields();
      this.draftLoading2 = false;
    },
    // 对话框1号显示状态变化
    modalChange1(flag) {
      if (flag == false) {
        this.$refs.draftForm.resetFields();
        this.file1 = [];
        this.queryForm = {
          workType: null,
          workDate: ["", ""]
        };
        this.submitForm(1);
      }
    },
    /**文件上传 */
    handleFormatError1() {
      this.info("只能上传pdf、mp4、xls、xlsx、jpg、png格式的文件！");
    },
    // 保存需要上传的文件
    handleUpload1(file) {
      let hz = file.name.split(".");
      let extra = hz[hz.length - 1]
      if (extra == "pdf" || extra == "mp4" || extra == "xls" || extra == "xlsx" || extra == "jpg" || extra == "png") {
        let keyID = Math.random()
          .toString()
          .substr(2);
        // 16位前端标志id
        file["keyID"] = keyID;
        this.file1.push(file);
        console.log(this.file1, "成功")
        return false;
      }
    },
    // 删除文件
    delectFile1(keyID) {
      this.file1 = this.file1.filter(item => {
        if (item.keyID == keyID) {
          // 保存到删除文件数组
          if (item.id) {
            this.deleteFiles1.push(item);
          }
        }
        return item.keyID != keyID;
      });
    },

    // 上传文件
    upload1() {
      console.log(this.file1, "日志制定上传文件");
      if (this.file1.length > 0) {
        for (let i = 0; i < this.file1.length; i++) {
          let item = this.file1[i];
          // 重新提交原文件不上传
          if (item.id) {
            this.fileIndex1++;
            // 如果全部是原文件
            if (this.fileIndex1 == this.file1.length) {
              this.draftLoading1 = false;
              this.modal1 = false;
              this.file1 = [];
              this.$refs.draftForm.resetFields();
              this.info("工作日志制定提交成功！");
            }
          } else {
            this.$refs.upload1.post(item);
          }
        }
      } else {
        this.draftLoading1 = false;
        this.$refs.draftForm.resetFields();
        this.file1 = [];
        this.info("工作日志制定提交成功！");
      }
    },

    // 文件上传成功
    uploadSuccess1(response, file, fileList) {
      this.fileIndex1++;
      this.$Message.info(response.data[0].name + "上传成功");
      if (this.fileIndex1 == this.file1.length) {
        this.draftLoading1 = false;
        this.modal1 = false;
        this.file1 = [];
        this.$refs.draftForm.resetFields();
        this.info("工作日志制定提交成功!");
      }
      return true;
    },

    // 文件上传失败
    uploadFail1(response, file, fileList) {
      // console.log(response, file, fileList);
      this.fileIndex1++;
      this.info(fileList.name + "上传失败");
      if (this.fileIndex1 == this.file1.length) {
        this.draftLoading1 = false;
        this.file1 = [];
        this.info("工作日志制定提交失败！");
      }
      return false;
    },

    // 对话框2号显示状态变化
    modalChange2(flag) {
      if (flag == false && this.fg == 1) {
        this.$refs.revokeForm.resetFields();
        this.file2 = [];
        this.queryForm = {
          workType: null,
          workDate: ["", ""]
        };
        this.workLogList = [];
        this.submitForm(1);
      }
    },
    // 工作日志回销
    revokeBtn(row) {
      this.fileIndex2 = 0
      console.log(row, "rowrow")
      // this.draftForm.expectEffect = row.expectEffect
      this.revokeForm = {
        revokeNews: "",
        revokeDate: new Date().getFullYear() + '-' + (Number(new Date().getMonth()) + 1) + '-' + new Date().getDate(),
        revokeTime: new Date().getHours() + ':' + new Date().getMinutes(),
        revokeSite: row.workSite,
        expectEffect2: row.expectEffect
      }
      console.log(this.revokeForm, "this.revokeForm")
      this.newsList.forEach(item => {
        if (item.value == row.workType) {
          this.revokeForm.revokeNews = item.key
        }
      })
      this.fg = 1;
      this.dustyId = row.id;
      this.modal2 = true;
    },
    // 工作日志撤销
    retractBtn(row) {
      console.log(row);
      // 确认
      this.$Modal.confirm({
        title: '确认',
        content: '您确认撤销该工作计划吗？',
        loading: true,
        onOk: () => {
          this.api.delectWorkDiary({ delectId: row.id }).then(res => {
            if (res.code == 200) {
              this.$Message.success(res.data);
              this.submitForm(1);
            } else {
              this.$Message.error(res.msg);
            }
          })
          this.$Modal.remove()
        }
      })
    },
    // 工作日志重新回销
    reRevokeBtn(row, index) {
      this.fileIndex2 = 0
      console.log(row);
      this.modal5 = true;
      this.draftLoading2 = false;
      this.fg = 1;
      this.dustyId = row.dustyId;
      this.api.getUserByNo({ no: row.reagentCode }).then(res => {
        if (res.code == 200 && res.data != null) {
          this.infoList = res.data;
        } else {
          this.info(res.msg);
        }
      });
      this.api.queryReturn({ returnId: row.dustyId || row.id }).then(res => {
        if (res.code == 200 && res.data != null) {
          this.returnList = res.data
        } else {
          this.info(res.msg);
        }
      })
      this.logDetail(row, index, true);

    },
    time(value, t) {
      let date = new Date(value)
      let getMonth = (date.getMonth() + 1).toString()
      let getDate = date.getDate().toString()
      return `${date.getFullYear()}-${getMonth.length === 1 ? '0' + getMonth : getMonth}-${getDate.length === 1 ? '0' + getDate : getDate}`
    },
    handleSubmit2() {
      console.log("2222")

      this.revokeForm.expectEffect2.forEach((item, index) => {
        item.orderNo = index + 1
      })
      this.$refs.revokeForm.validate(valid => {
        if (valid) {
          this.draftLoading2 = true;
          let obj = {
            workType: this.revokeForm.revokeNews,
            workDay: this.time(this.revokeForm.revokeDate),
            workTime: this.revokeForm.revokeTime,
            workSite: this.revokeForm.revokeSite,
            // expectEffect: this.revokeForm.expectEffect2,
            jobContent: this.revokeForm.expectEffect2,
            status: "2",
            dustyId: this.dustyId, //回销时调用
            id: this.userId
          };
          // console.log(obj)
          // 删除文件
          if (this.deleteFiles2) {
            this.deleteFiles2.forEach(element => {
              if (element.id) {
                this.api.deleteAttachment({ id: element.id }).then(res => {
                  if (res.code == 200) {
                  } else {
                    this.info(res.msg);
                    return false;
                  }
                });
              }
            });
          }
          this.api.addUerWorkDiary(obj).then(res => {
            if (res.code == 200 && res.data != null) {
              if (res.data) {
                this.$refs.upload2.data.applyNo = res.data;
                if (this.file2) {
                  // this.submitForm(1);
                  this.modal2 = false;
                }
              } else {
                this.info("文件上传失败");
              }
              this.upload2();
            } else {
              this.draftLoading2 = false;
              this.info(res.msg);
            }
          });
        }
      });
    },
    /**文件下载 */
    handleFormatError2() {
      this.info("只能上传pdf、mp4、xls、xlsx、jpg、png格式的文件！");
    },
    // 保存需要上传的文件
    handleUpload2(file) {
      let hz = file.name.split(".");
      let extra = hz[hz.length - 1]
      // if (hz[1] == "pdf" || hz[1] == "mp4") {
      if (extra == "pdf" || extra == "mp4" || extra == "xls" || extra == "xlsx" || extra == "jpg" || extra == "png") {
        let keyID = Math.random()
          .toString()
          .substr(2);
        // 16位前端标志id
        file["keyID"] = keyID;
        this.file2.push(file);
        console.log(this.file2, "this.file2this.file2this.file2this.file2")
        return false;
      }
    },
    // 删除文件
    delectFile2(keyID) {
      this.file2 = this.file2.filter(item => {
        if (item.keyID == keyID) {
          // 保存到删除文件数组
          if (item.id) {
            this.deleteFiles2.push(item);
          }
        }
        return item.keyID != keyID;
      });
    },

    // 上传文件
    upload2() {
      console.log(this.file2, "222222222222222222222222");
      if (this.file2.length > 0) {
        for (let i = 0; i < this.file2.length; i++) {
          let item = this.file2[i];
          // 重新提交原文件不上传
          if (item.id) {
            this.fileIndex2++;
            // 如果全部是原文件
            if (this.fileIndex2 == this.file1.length) {
              this.draftLoading2 = false;
              this.file2 = [];
              this.$refs.revokeForm.resetFields();
              this.modal2 = false;
              // this.submitForm(1);
              this.info("工作日志回销提交成功！");
            }
          } else {
            this.$refs.upload2.post(item);
          }
        }
      } else {
        this.draftLoading2 = false;
        this.$refs.revokeForm.resetFields();
        this.file2 = [];
        // this.submitForm(1);
        this.info("工作日志回销提交成功！");
      }
    },

    // 文件上传成功
    uploadSuccess2(response, file, fileList) {
      this.fileIndex2++;
      this.$Message.info(response.data[0].name + "上传成功");
      if (this.fileIndex2 == this.file2.length) {
        this.draftLoading2 = false;
        this.file2 = [];
        this.$refs.revokeForm.resetFields();
        this.modal2 = false;
        // this.submitForm(1);
        this.info("工作日志回销提交成功!");
      }
      return true;
    },

    // 文件上传失败
    uploadFail2(response, file, fileList) {
      // console.log(response, file, fileList);
      this.fileIndex2++;
      this.info(fileList.name + "上传失败");
      if (this.fileIndex2 == this.file2.length) {
        this.draftLoading2 = false;
        this.file2 = [];
        this.info("工作日志回销提交失败！");
      }
      return false;
    },
    Echo() {
      this.jsonData = util.GetRequest(decodeURI(location.hash)) || {}
      console.log(this.jsonData, "this.this.jsonData");
      if (this.jsonData.workType || (this.jsonData.index != 1) || this.jsonData.workBeginDay || this.jsonData.workEndDay) {
        console.log('能进来');
        // this.queryForm.workType = this.jsonData.workType     //工作类型
        // this.pageIndex  = this.jsonData.index              // 页码
        // let arr = []
        // arr.push(this.jsonData.workBeginDay,his.jsonData.workEndDay)
        // this.queryForm.workDate = arr   //日志起始时间

        // this.dayForm.organization = arr
        // console.log(arr,'arrrr222222')
        this.pageIndex = parseInt(this.jsonData.index)
        // this.submitForm(1)
      } else {
        console.log("进不来呀");
        this.submitForm(1)
      }
    },
    delectRecordFile(e, index) {
      this.revokeList2.files.splice(index, 1)
      this.recordFile.push(e)
    },
    // 重新回销
    reRecord() {
      this.revokeForm.expectEffect2.forEach((item, index) => {
        item.orderNo = index + 1
      })
      this.$refs.revokeForm.validate(valid => {
        if (valid) {
          this.draftLoading2 = true;
          let obj = {
            workType: this.revokeForm.revokeNews,
            workDay: this.time(this.revokeForm.revokeDate),
            workTime: this.revokeForm.revokeTime,
            workSite: this.revokeForm.revokeSite,
            // expectEffect: this.revokeForm.expectEffect2,
            jobContent: this.revokeForm.expectEffect2,
            status: "2",
            dustyId: this.dustyId, //回销时调用
            reagentCode: this.userId
          };
          console.log(obj)
          // 删除文件
          if (this.recordFile.length > 0) {
            this.recordFile.forEach(element => {
              this.api.deleteAttachment({ id: element }).then(res => {
                if (res.code == 200) {
                } else {
                  this.info(res.msg);
                  return false;
                }
              });
            });
          }
          this.api.addUerWorkDiary(obj).then(res => {
            if (res.code == 200 && res.data != null) {
              if (res.data) {
                this.$refs.upload6.data.applyNo = res.data;
                if (this.file2) {
                  this.submitForm(1);
                  this.modal5 = false;
                }
              } else {
                this.info("文件上传失败");
              }
              // this.upload2();
              if (this.file2.length > 0) {
                for (let i = 0; i < this.file2.length; i++) {
                  let item = this.file2[i];
                  // 重新提交原文件不上传
                  if (item.id) {
                    this.fileIndex2++;
                    // 如果全部是原文件
                    if (this.fileIndex2 == this.file1.length) {
                      this.draftLoading2 = false;
                      this.file2 = [];
                      this.$refs.revokeForm.resetFields();
                      this.modal5 = false;
                      this.submitForm(1);
                      this.info("工作日志回销提交成功！");
                    }
                  } else {
                    this.$refs.upload6.post(item);
                  }
                }
              } else {
                this.draftLoading2 = false;
                this.$refs.revokeForm.resetFields();
                this.file2 = [];
                this.submitForm(1);
                this.modal5 = false;
                this.info("工作日志回销提交成功！");
              }
            } else {
              // this.modal5 = false;
              this.draftLoading2 = false;
              this.info(res.msg);
            }
          });
        }
      });
    }
  },
  mounted() {
    // 获取UserId、tocken令牌
    this.userId = sessionStorage.getItem("useragentcode");
    // this.action = sessionStorage.getItem("userIp") + "api/fileupload/up";
    this.action = "/scrm-gateway/scrm-uer/api/fileupload/up";
    this.tocken = sessionStorage.getItem("credentials");
    this.submitForm(1);
    // this.Echo()
  },
  created() {
    // this.reagentCode = sessionStorage.getItem("useragentcode")
    // if(this.reagentCode){
    // setTimeout(() => {
    //   this.Echo()
    // },500)
    // }else{
    //   console.log("没值");
    // }
  },
  beforeDestroy() {
    this.btn = null;
    this.queryForm = null;
    this.newsList = null;
    this.workLogList = null;
    this.queryLoading = null;
    this.modal1 = null;
    this.draftForm = null;
    this.draftLoading1 = null;
    this.draftRoleValidate1 = null;
    this.action = null;
    this.tocken = null;
    this.fileLoading1 = null;
    this.file1 = null;
    this.delectFiles1 = null;
    this.fileIndex1 = null;
    this.modal2 = null;
    this.revokeForm = null;
    this.draftLoading2 = null;
    this.draftRoleValidate2 = null;
    this.fileLoading2 = null;
    this.file2 = null;
    this.delectFiles2 = null;
    this.fileIndex2 = null;
    this.modal3 = null;
    this.uncancelledForm = null;
    this.modal4 = null;
    this.revokedForm = null;
    this.startForm = null;
    this.total = null;
    this.pageSize = null;
    this.pageIndex = null;
    this.pageObj = null;
    this.status = null;
    this.statusObj = null;
    this.userId = null;
    this.dustyId = null;
    this.revokeList1 = null;
    this.revokeList2 = null;
    this.assessList = null;
    this.fg = null;
    this.videoModal = null;
    this.replayInputArr = null;
    this.clickItem = null;
    this.clickIndex = null;
  },
  activated() {
    // console.log('进来');
    // Object.assign(this.$data,this.$options.data())
  },
  deactivated() {
    // console.log("离开");
    //  Object.assign(this.$data,this.$options.data())
  },
  // beforeRouteEnter(to,form,next){
  //   console.log(to,form,"toform");
  //   // next()
  // }
};
</script>


<style lang="less" scoped>
@import "./index";
</style>

<style>
.tooltipContent {
  text-align: center;
  background-color: #FE8D13 !important;
  padding-left: 10px;
  padding-right: 10px;
  border-radius: 10px;
  font-size: 12px;
  /* margin-bottom: 10px; */
}

.ivu-modal-header {
  background-color: #2d8cf0;
}

.ivu-icon-ios-close:before,
.ivu-modal-close .ivu-icon-ios-close {
  color: white !important;
}

.examCard .ivu-card-extra {
  width: 100%;
  position: absolute;
  top: 0;
  right: 0;
}

.revokeModal .ivu-modal-body {
  max-height: 500px;
  overflow-x: hidden;
}
</style>
